
use data1998.dta,clear

****cohorts of 40-45 as treated group and 1924-1935 as control group*************
	
******EDUCATION********
****TABLE 2********
	****dummy*******
		******North**********
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs{
		eststo: xi: quietly ivreg2 `var' d_interact1  sex ethnicity_head buddhist catholic i.birthyear  birthprovince2-birthprovince30 if t1==1&birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("TABLE 2-whole sample-dummy")
		eststo clear
				
		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Female-dummy")
		eststo clear
		
			
		*****male*******
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs {
		eststo:xi: quietly ivreg2 `var' d_interact1 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("TABLE 2-Male-dummy")
		eststo clear
		
		
	******Test for equality of the estimated coefficient -SUREST ******
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs {

			xi: quietly reg `var' d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15
			est store `var'1
			xi: quietly reg readability d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15
			est store `var'0
		}
		suest readability1 readability0
		test [readability1_mean]d_interact1=[readability0_mean]d_interact1 
		
		suest mathability1 mathability0
		test [mathability1_mean]d_interact1=[mathability0_mean]d_interact1 
		
		suest diploma11 diploma10
		test [diploma11_mean]d_interact1=[diploma10_mean]d_interact1 
		
		suest diploma21 diploma20
		test [diploma21_mean]d_interact1=[diploma20_mean]d_interact1 

		suest educationyrs1 educationyrs0
		test [educationyrs1_mean]d_interact1=[educationyrs0_mean]d_interact1 
		
		**********************************
**Table 3- years of exposure ***
		****North ***
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed sex ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445& birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("TABLE 2-Whole sample-years of exposure")
		
		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 & birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Female-years of exposure")
		eststo clear
		
		****male*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 & birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Male-years of exposure")
		eststo clear

********ROBUSTNESS CHECKS********		
	
***Table 4A - Girls *****		
	
***Panel A - placebo 1**** 
  **treated cohorts-young cohorts -1961-1966; control cohorts: 1955-1960************
	****dummy***
	******North**********
	foreach var of varlist readability mathability  diploma1 diploma2 educationyrs {
	eststo: xi: quietly ivreg2 `var' d_interact_false  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t_f==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
	}

	esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact_false) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace  ar2 title("panel A")
	eststo clear
	
**Panel B--- North - female- including migrants less than 15*******
		***dummy***
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("panel B")
		eststo clear
	
**Panel C - new years of exposure*************
		****Panel : including migrants less than 15*******
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' new_yr_exposed ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==0,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(new_yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("panel C")
		eststo clear		
			
**Panel D--- North - female- control for living years in current place*******
		***dummy***
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1 living_years ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("panel D")
		eststo clear

**Panel E- control for parental education*****		
	*** dummy*****
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  father_educationyrs mother_educationyrs ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("panel E")
		eststo clear

**Table 5: heterogeneity analysis*********

****interactions**********
	****dummy*******
		******North**********
		***interact with kinh or Hoa groups****
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' ethnic_interact_d d_interact1 ethnicity_head buddhist catholic i.birthyear  birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(ethnic_interact_d d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace  ar2 title("Table 5-kinh or Hoa groups")
		eststo clear
					
				
	*******years of exposure*******
		******North**********
		***kinh or Hoa groups****
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' ethnic_exposed yr_exposed ethnicity_head buddhist catholic i.birthyear  birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(ethnic_exposed yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Table 5-kinh or Hoa groups_years")
		eststo clear
	
		
***********************************
********APPENDIX***************

***A.1****
*******South*******************
*******************************
****cohorts of 40-45 as treated group and 1924-1935 as control group*************

  ***Panel A*****
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  sex ethnicity_head buddhist catholic i.birthyear  birthprovince32-birthprovince61 if t1==1&birthprovince>30&birthprovince<62&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace  ar2 title("Panel A")	
		eststo clear
		
   ***Panel B - female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince32-birthprovince61 if t1==1&birthprovince>30&birthprovince<62&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Panel B")
		eststo clear
		
	***Panel C - male*******
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs{
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince32-birthprovince61 if t1==1&birthprovince>30&birthprovince<62&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Panel C")
		eststo clear


***Table A.2*********

  *****Girls************* 
	 ***Panel A - provinces adjacent to Vietminh-controlled provinces************
			foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
			eststo: xi: quietly ivreg2 `var' d_interact1 d_interact_adj  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
			}
			
			esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1 d_interact_adj) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Panel A")
			eststo clear
			
	**Panel B - remove incompletely-occupied provinces*****
			foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
			eststo: xi: quietly reg `var' d_interact1 vietminh birthyear_treated1 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15&(years_occupation==0|years_occupation==9),cluster(birthprovince)
			}
			
			esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Panel B")
			eststo clear
			
****A.3- female treatment group: cohorts of 1936-39***********
		
		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' interact3639  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t3639==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(interact3639) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Table A.3")
		eststo clear
						
**** A.4 - girls*******
		****North ***
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact2933 d_interact3439 d_interact4045 sex ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445& birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact2933 d_interact3439 d_interact4045) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Table A.4")
		eststo clear
		
****A.5- boys*********	
		****North ***
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact2933 d_interact3439 d_interact4045 sex ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445& birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact2933 d_interact3439 d_interact4045) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Table A.5")
		eststo clear

****A.6-female - years of exposure****
	****Panel A: including migrants less than 15*******
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==0,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Panel A")
		eststo clear

	**Panel B--- North - female- control for living years in current place*******
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed living_years ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Panel B")
		eststo clear

	**Panel C- control for parental education*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed father_educationyrs mother_educationyrs ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Panel C")
		eststo clear
		
****A.7****
*****Dummy****
	**Panel A--- North - female- including migrants less than 15*******
		***dummy***
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace  ar2 title("Panel A")
		eststo clear
		
	**Panel B--- North - female- control for living years in current place*******
		***dummy***
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1 living_years ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Panel B")
		eststo clear		
		
	**Panel C- control for parental education*****		
		*** dummy*****
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  father_educationyrs mother_educationyrs ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Panel C")
		eststo clear
****years of exposure**
		**Panel A - North - female- including migrants less than 15*******
				
		****years of exposure****
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==1,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Panel A-years of exposure")
		eststo clear

		**Panel B - North - female- control for living years in current place*******	
		****years of exposure****
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed living_years ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("panel B-years of exposure")
		eststo clear
	**Panel C - control for parental education*****		
	
		****years of exposure****
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed father_educationyrs mother_educationyrs ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Panel C-years of exposure")
		eststo clear
		

		
********A.8-matching an did sample************
		
		*****whole sample******
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: diff `var' if t1==1&birthprovince<31&moveage>15, treated(vietminh) period(birthyear_treated1) kernel rcs cov(ethnicity_head buddhist catholic age) cluster(birthprovince) robust
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(_diff) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Table 1.4-panel C-dummy")
		eststo clear
		
		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: diff `var' if t1==1&birthprovince<31&sex==0&moveage>15, treated(vietminh) period(birthyear_treated1) kernel rcs cov(ethnicity_head buddhist catholic age) cluster(birthprovince) robust
		}
		esttab using "$directory\outcome1.rtf", compress b(3) keep(_diff) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Table 1.4-panel C-dummy")
		eststo clear
		
		*****male*******
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: diff `var' if t1==1&birthprovince<31&sex==1&moveage>15, treated(vietminh) period(birthyear_treated1) kernel rcs cov(ethnicity_head buddhist catholic age) cluster(birthprovince) robust
		}
		esttab using "$directory\outcome1.rtf", compress b(3) keep(_diff) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Table 1.4-panel C-dummy")
		eststo clear
		

****A. 9 - girls******
   
	******dummy**********
	foreach var of varlist d_interna_migrate{
	eststo: xi: quietly ivreg2 `var' d_interact1 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
	}
	esttab using "$directory\output.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("dummy")
	eststo clear
	
		****years of exposure ***
	foreach var of varlist d_interna_migrate{
	eststo: xi: quietly ivreg2 `var' yr_exposed  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
	}

	esttab using "$directory\output.rtf",  compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("years of exposure")
	eststo clear	
	
 ***A. 10- boys******
   
	******dummy**********
	foreach var of varlist d_interna_migrate{
	eststo: xi: quietly ivreg2 `var' d_interact1 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
	}
	esttab using "$directory\output.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("dummy")
	eststo clear
	
		****years of exposure ***
	foreach var of varlist d_interna_migrate{
	eststo: xi: quietly ivreg2 `var' yr_exposed  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 &birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
	estadd ysumm
	}

	esttab using "$directory\output.rtf",  compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("years of exposure")
	esttab using "$directory\outcome1.rtf", stats(ymean) compress b(3) keep(yr_exposed)  append
	eststo clear
	
*****Table A.11 using VLSS 1993******	
	
*******A.12********
	****dummy*******
		******North**********
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs{
		eststo: xi: quietly ivreg2 `var' interact1  sex ethnicity_head buddhist catholic i.birthyear  birthprovince2-birthprovince30 if t1==1&birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Panel A")
		eststo clear

		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' interact1  ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Panel B")
		eststo clear

		*****male*******
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs {
		eststo:xi: quietly ivreg2 `var' interact1 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("Panel C")
		eststo clear
		
	
*****A.13 - control for current province rather than birthprovince******
****TABLE 2 for female only********
	****dummy*******
	
		******North**********
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear province2-province30 if t1==1&birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("whole")
		eststo clear
		
		
		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear province2-province30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Female-dummy")
		eststo clear
		
		****male*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1  ethnicity_head buddhist catholic i.birthyear province2-province30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("male-dummy")
		eststo clear
		
		
		**********************************
		****years of exposure ***
		
		****North*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear province2-province30 if $by2445 & birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Whole-years of exposure")
		eststo clear
		
			****female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear province2-province30 if $by2445 & birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Female-years of exposure")
		eststo clear
		
		****male*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed ethnicity_head buddhist catholic i.birthyear province2-province30 if $by2445 & birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("male-years of exposure")
		eststo clear
		
		
		
****A. 14 - adding more table for years of exposure***********		
****modified Table 2 for different years of exposure*********
   ****4 years of exposure ***
		****North ***
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed4 sex ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445& birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed4) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Whole sample-years of exposure")
		eststo clear
		
				****female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed4 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 & birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed4) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Female-years of exposure")
		eststo clear
		
				****male*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed4 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 & birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}
	
		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed4) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Male-years of exposure")
		eststo clear

   ****3 years of exposure ***
		****North ***
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed3 sex ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445& birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed3) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("Whole sample-years of exposure")
		eststo clear
				****female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed3 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 & birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed3) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Female-years of exposure")
		eststo clear
				****male*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed3 ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if $by2445 & birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed3) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("Male-years of exposure")
		eststo clear

*****A. 15**********
*******control for number of battles******
	****dummy*******
		******North**********
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs{
		eststo: xi: quietly ivreg2 `var' d_interact1 battle sex ethnicity_head buddhist catholic i.birthyear  birthprovince2-birthprovince30 if t1==1&birthprovince<31&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  replace   ar2 title("TABLE 2-whole sample")
		eststo clear

		****female*****		
		foreach var of varlist readability mathability diploma1 diploma2  educationyrs {
		eststo: xi: quietly ivreg2 `var' d_interact1 battle ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}
		
		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Female")
		eststo clear
		
		*****male*******
		foreach var of varlist  readability mathability diploma1 diploma2 educationyrs {
		eststo:xi: quietly ivreg2 `var' d_interact1 battle ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if t1==1&birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(d_interact1) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append  ar2 title("TABLE 2-Male")
		eststo clear
		
		**********************************
		****years of exposure ***
		****North ***
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed battle sex ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if birthyear>= 1924 & birthyear<= 1945 & birthprovince<31 & moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Whole sample")
		eststo clear
				****female*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed battle ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if  birthyear>= 1924 & birthyear<= 1945 &birthprovince<31&sex==0&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Female")
		eststo clear
				****male*****		
		foreach var of varlist readability mathability diploma1 diploma2 educationyrs {
		eststo: xi: quietly ivreg2 `var' yr_exposed battle ethnicity_head buddhist catholic i.birthyear birthprovince2-birthprovince30 if  birthyear>= 1924 & birthyear<= 1945 &birthprovince<31&sex==1&moveage>15,cluster(birthprovince commune) small
		}

		esttab using "$directory\outcome1.rtf", compress b(3) keep(yr_exposed) se(3)   star(* 0.10 ** 0.05 *** 0.01)  nogaps parentheses  append   ar2 title("TABLE 2-Male")
		eststo clear
		
		



